<link rel="stylesheet" type="text/css" href="{$_G['URL']['APP_CSS']}check_package.css" />

<div class="content font_wrap" id="goto_here">
	<div class="content font_list  prize_list_1">
		<div class="content font_img">
			{if empty($themyrecordid)}
				{loop $giftlist $item}
				<div class="font_imgradio content ">
					<label class="content label_1"  for="wctice_{$item['giftgroupid']}_{$item['id']}" onclick="return checkselect({$item['giftgroupid']},{$item['id']})">
						<img src="{$_G['attachurl']}{$item['giftimg']}" alt="">
					</label>
					<input type="checkbox" value="{$item['id']}"  name="prize_id" id="wctice_{$item['giftgroupid']}_{$item['id']}" class="select_prize_id" onchange="changeselect()" />
					<label class="selected-icon"  for="wctice_{$item['giftgroupid']}_{$item['id']}" onclick="return checkselect({$item['giftgroupid']},{$item['id']})"></label>
					<input type="hidden" class="giftprize" value="{$item['giftjiazhi']}" />
					<input type="hidden" class="giftprice" value="{$item['price']}" />
				</div>
				{/loop}
			
			{else}
				{loop $hasgiftlist $item}
				<div class="font_imgradio content ">
					<label class="content label_1" >
						<img src="{$_G['attachurl']}{$item['giftimg']}" alt="">
					</label>
					<input type="checkbox" value="{$item['id']}"  name="prize_id"  class="select_prize_id" checked="checked"/>
					<label class="selected-icon"  ></label>
					<input type="hidden" class="giftprize" value="{$item['giftjiazhi']}" />
					<input type="hidden" class="giftprice" value="{$item['price']}" />
				</div>
				{/loop}
			{/if}
		</div>
	</div>
</div>


<!--侧边栏显示大礼包-->
<!-- {if $config['giftgroupid'] > 0}
{if empty($themyrecordid)}
<div class="da_right base_ground">
{if $config['typeid'] == 0}
	<span><b>可选服务：</b><i><font color="yellow" id="getprizenums" >0</font>/{$theme['gifttypeselect']}</i></span>
{else}
	<span><b>可选服务：</b><i><font color="yellow" id="getprizenums" >0</font>/{$theme['gifttypesum']}</i></span>
{/if}
	<em><b>价值总额：</b><i class="allprizeprice">0</i></em>
</div>
{else}
<div class="da_right base_ground">
{if $config['typeid']==0}
	<span><b>已选服务：</b><i><font color="yellow" id="getprizenums" >{$theme['gifttypeselect']}</font>/{$theme['gifttypeselect']}</i></span>
{else}
	<span><b>已选服务：</b><i><font color="yellow" id="getprizenums" >{$hasgiftlcount}</font>/{$theme['gifttypesum']}</i></span>
{/if}
	<em><b>价值总额：</b><i class="allprizeprice">{$jiazsum}</i></em>
</div>
{/if}
{/if} -->

<script type="text/javascript">
var prizes_arr = [];
prizes_arr[0] = {$config['gifttypeselect2']};
prizes_arr[1] = 0;


function checkselect(classid, prizeid){
	if($('#wctice_' + classid + '_' + prizeid).is(":checked")){
		return true;
	}
	{if $theme['typeid'] == 0}
	if(prizes_arr[classid] > 0){
		var prizes = $('.prize_list_' + classid ).find('.select_prize_id:checked');
		console.log(prizes);
		if(prizes.length >= prizes_arr[classid]){
			ds.dialog({
				title : '&#25805;&#20316;&#25552;&#31034;',
				content : $('#wctice_' + classid + '_' + prizeid).parent().parent().parent().find('.getprizename').html() + '最多只能选择' + prizes_arr[classid] + '&#39033;',
				yesText : '&#30830;&#23450;',
			    timeout :2.5,
			});
			return false;
		}
	}
	
	if(prizes_arr[0] > 0){
		var prizes = $('.select_prize_id:checked');
		if(prizes.length >= prizes_arr[0]){
			ds.dialog({
				title : '&#25805;&#20316;&#25552;&#31034;',
				content : '&#27492;&#27963;&#21160;&#26368;&#22810;&#21482;&#33021;&#36873;&#25321;' + prizes_arr[0] + '&#39033;',
				yesText : '&#30830;&#23450;',
			    timeout :2.5,
			});
			return false;
		}
	}
	{/if}
}

function changeselect(){
	var prizes = 0, price = 0,allhadselect=0;
	$('.select_prize_id:checked').each(function(){
		allhadselect ++;
		prizes = prizes + $(this).parent().find('.giftprize').val()*1;
		price = price + $(this).parent().find('.giftprice').val()*1;
	});

	$('#getprizenums').text(allhadselect);
	$('.allprizeprice').html(prizes);
	{if $config['typeid'] == 1}
	var info = '';
	if(price == '0'){
		info = '选择礼品';
	}else{
		info = '支付'+price+'元领取'
	}
	$('.payinfo').html(info);
	{/if}
}



</script>